﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Lidgren.Network;

namespace TradeSeaShared
{
    [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
    public class PacketAttribute : Attribute
    {
        public int ID;

        // This is a positional argument
        public PacketAttribute(int id)
        {
            this.ID = id;
        }
    }

    public class ServerPackets
    {
        [Packet(1)]
        public static void ChatMessage(NetIncomingMessage msg, INet server)
        {
            NetOutgoingMessage outMsg = server.CreateMessage(1);
            outMsg.Write(msg.ReadString());
            server.SendMessageToAll(outMsg);
        }

        [Packet(2)]
        public static void BoatUpdate(NetIncomingMessage msg, INet server)
        {
            TradeSea.ServerBoats.UpdateBoat(msg.ReadFloat(), msg.ReadFloat(), msg.SenderConnection);
        }

        [Packet(3)]
        public static void ShopUpdate(NetIncomingMessage msg, INet server)
        {
           
        }
    }
}
